Assignemnt #48 and Forty-fifth Program
Code
///Name: Derrick Andreasen
///Period: 7
///Program name: forty-fifth Program
///File name: Fourt5Prog.java
///Date Finished:10/21/2015
import java.util.Scanner;
public class Fort5Prog
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
int height, weight, bmi;
System.out.print( "Your height in m: " );
height = keyboard.nextInt();
System.out.print( "Your weight in kg: " );
weight = keyboard.nextInt();
bmi = weight / (height*height);
System.out.println( "Your BMI is " + bmi );
if(bmi < 15)
{
System.out.println( "Very severely underweight" );
}
if(bmi >= 15 && bmi <=16)
{
System.out.println( "Severely underweight" );
}
if(bmi >= 16.1 && bmi <= 18.4)
{
System.out.println( "Underweight" );
}
if(bmi >= 18.5 && bmi <= 24.9)
{
System.out.println( "Normal weight" );
}
if(bmi >= 25.0 && bmi <= 29.9)
{
System.out.println( "Obese" );
}
if(bmi >= 30.0 && bmi <= 34.9)
{
System.out.println( "Moderately obese" );
}
if(bmi >= 35.0 && bmi <=39.9 )
{
System.out.println( "Severely obese" );
}
if(bmi >= 40)
{
System.out.println( "Very severely obese" );
}
}
}
Picture of the output